package youth;
// Person 类 - 人类基类
class Person {
    protected String name;
    protected int age;
    protected String gender;
    protected String school;

    public Person(String name, int age, String gender, String school) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.school = school;
    }

    public void introduce() {
        System.out.println("姓名: " + name);
        System.out.println("年龄: " + age);
        System.out.println("性别: " + gender);
        System.out.println("学校: " + school);
    }
}

// OrdinaryYouth 类 - 普通青年类
class OrdinaryYouth extends Person {
    private String job;

    public OrdinaryYouth(String name, int age, String gender, String school, String job) {
        super(name, age, gender, school);
        this.job = job;
    }

    @Override
    public void introduce() {
        super.introduce();  // 调用父类的介绍方法
        System.out.println("工作: " + job);
    }
}

// ArtisticYouth 类 - 文艺青年类
class ArtisticYouth extends Person {
    private String masterpiece;
    private String dream;

    public ArtisticYouth(String name, int age, String gender, String school, String masterpiece, String dream) {
        super(name, age, gender, school);
        this.masterpiece = masterpiece;
        this.dream = dream;
    }

    @Override
    public void introduce() {
        super.introduce();  // 调用父类的介绍方法
        System.out.println("代表作: " + masterpiece);
        System.out.println("梦想: " + dream);
    }
}

// Test 类 - 测试类
public class Test {
    public static void main(String[] args) {
        // 创建普通青年对象
        OrdinaryYouth ordinaryYouth = new OrdinaryYouth("张明", 25, "男", "北京大学", "软件工程师");
        System.out.println("普通青年自我介绍：");
        ordinaryYouth.introduce();

        System.out.println();

        // 创建文艺青年对象
        ArtisticYouth artisticYouth = new ArtisticYouth("李婷", 23, "女", "清华大学", "《诗与远方》", "成为一名作家");
        System.out.println("文艺青年自我介绍：");
        artisticYouth.introduce();
    }
}
